package cn.jiyun.service.impl;

import cn.jiyun.mapper.UserMapper;
import cn.jiyun.pojo.User;
import cn.jiyun.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public void add(User user) {
        userMapper.inserUser(user);
    }

    @Override
    public List<User> listUser() {
      List<User>users  =  userMapper.select();
      return users;
    }

    @Override
    public User findId(Integer id) {
        User user1 = userMapper.selectbyid(id);
        return user1;
    }

    @Override
    public void update(User user) {
        userMapper.update(user);
    }

    @Override
    public void delete(Integer id) {
        userMapper.delete(id);

    }

    @Override
    public User login(User user) {
        User u =userMapper.login(user);
        return u;
    }
}
